#include "tv.h"


bool Tv::volup()
{
    if (volume < MaxVal)
    {
        volume++;
        return true;
    }
    else
    {
        return false;
    }
    
}

bool Tv::voldown()
{
    if (volume > MinVal)
    {
        volume--;
        return true;
    }
    else
    {
        return false;
    }
}

void Tv::chanup()
{
    if (channel < maxchannel)
    {
        channel++;
    }
    else
    {
        channel = 1;
    }
}

void Tv::chandown()
{
    if (channel > 1)
    {
        channel--;
    }
    else
    {
        channel = maxchannel;
    }
}

void Tv::settings() const
{
    cout << "TV is " << (state == Off ? "Off" : "On") << endl;
    if (state == On)
    {
        cout << "volume setting = " << volume << endl;
        cout << "channel setting = " << channel << endl;
        cout << "Mode=" << (mode == Antrnna ? "antenna" : "cable") << endl;
        cout << "input=" << (input == TV ? "TV" : "DVD") << endl;
    }
}

void Tv::set_Rmode(Remote& r)
{
    if (ison())
    {
        r.work_mode = (r.work_mode == Remote::Normal) ? Remote::InterActive : Remote::Normal;
    }
}

